void killsharks()
{
sharks.resize(0);
deepsharks=0;
seaside_townsharks=0;
}
void seaside_townsharkloop()
{
if(sharkspawntimer.elapsed>=2000 and players.length>0 and allowspawningsharks==true)
{
sharkspawntimer.restart();
if(seaside_townsharks<=4)
{
seaside_townsharks++;
animals++;
spawn_shark(random(20,  480), random(250, 280), 0, "seaside_town");
}
}
}
void deepsharkloop()
{
if(sharkspawntimer.elapsed>=20000 and players.length>0 and allowspawningsharks==true)
{
sharkspawntimer.restart();
if(deepsharks<=8)
{
deepsharks++;
animals++;
spawn_shark(random(1,  499), random(1, 999), 0, "deep");
}
}

if(sharks[i].movetimer.elapsed>=sharks[i].movetime)
{
sharks[i].movetimer.restart();
if(sharks[i].x<players[index].x) sharks[i].x++;
if(sharks[i].x>players[index].x) sharks[i].x--;
if(sharks[i].y>players[index].y) sharks[i].y--;
if(sharks[i].y<players[index].y) sharks[i].y++;
if(sharks[i].z>players[index].z) sharks[i].z--;
if(sharks[i].z<players[index].z and sharks[i].map=="deep") sharks[i].z++;
if(sharks[i].map=="deep") sharks[i].minx=20;
if(sharks[i].map=="deep") sharks[i].maxx=480;
if(sharks[i].map=="deep") sharks[i].miny=50;
if(sharks[i].map=="deep") sharks[i].maxy=950;
if(sharks[i].map=="seaside_town") sharks[i].minx=20;
if(sharks[i].map=="seaside_town") sharks[i].maxx=480;
if(sharks[i].map=="seaside_town") sharks[i].miny=250;
if(sharks[i].map=="seaside_town") sharks[i].maxy=480;
if(sharks[i].map=="seaside_town") sharks[i].maxz=23;
if(sharks[i].map=="deep") sharks[i].maxz=105;
if(sharks[i].x<sharks[i].minx )sharks[i].x++;
if(sharks[i].x>sharks[i].maxy) sharks[i].x--;
if(sharks[i].y>sharks[i].maxy) sharks[i].y--;
if(sharks[i].y<sharks[i].miny) sharks[i].y++;
if(sharks[i].z>sharks[i].maxz) sharks[i].z--;
play(get_tile_at(sharks[i].x, sharks[i].y, sharks[i].z, sharks[i].map)+"step"+random(1,1), sharks[i].x, sharks[i].y, sharks[i].z, sharks[i].map, -1, true, false, 5);
}
else
{
sharks.remove_at(i);
continue;
}
}
}
if(sharks[i].map=="deep")
{
deepsharks--;
}
if(sharks[i].map=="seaside_town")
{
seaside_townsharks--;
}
animals--;
